package com.eqs.enterprisequestionnaire.controller;

import com.eqs.enterprisequestionnaire.result.R;
import com.eqs.enterprisequestionnaire.service.DifferenceSortQuestionAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/differenceSortQuestionAnalysis")
public class DifferenceSortQuestionAnalysisController {

    @Autowired
    private DifferenceSortQuestionAnalysisService differenceSortQuestionAnalysisService;

    @GetMapping("/gender1/{questionId}")
    public R<Map<Boolean, Map<String, Double>>> getGenderDifference(@PathVariable Integer questionId) {
        Map<Boolean, Map<String, Double>> result = differenceSortQuestionAnalysisService.getGenderDifference(questionId);
        return R.success(result);
    }
    @GetMapping("/age1/{questionId}")
    public R<Map<String, Map<String, Double>>> getAgeDifference(@PathVariable Integer questionId) {
        Map<String, Map<String, Double>> result = differenceSortQuestionAnalysisService.getAgeDifference(questionId);
        return R.success(result);
    } @GetMapping("/enterprise1/{questionId}")
    public R<Map<String, Map<String, Double>>> getEnterpriseDifference(@PathVariable Integer questionId) {
        Map<String , Map<String, Double>> result = differenceSortQuestionAnalysisService.getEnterpriseDifference(questionId);
        return R.success(result);
    } @GetMapping("/role1/{questionId}")
    public R<Map<String, Map<String, Double>>> getRoleDifference(@PathVariable Integer questionId) {
        Map<String, Map<String, Double>> result = differenceSortQuestionAnalysisService.getRoleDifference(questionId);
        return R.success(result);
    }

    @GetMapping("/gender2/{questionId}")
    public R<Map<Boolean, Map<String, List<Double>>>> getGenderDifferenceAnalysis(@PathVariable Integer questionId) {
        Map<Boolean, Map<String, List<Double>>> result = differenceSortQuestionAnalysisService.getGenderDifferenceAnalysis(questionId);
        return R.success(result);
    }

    // Endpoint for age differential analysis
    @GetMapping("/age2/{questionId}")
    public R<Map<String, Map<String, List<Double>>>> getAgeDifferenceAnalysis(@PathVariable Integer questionId) {
        Map<String, Map<String, List<Double>>> result = differenceSortQuestionAnalysisService.getAgeDifferenceAnalysis(questionId);
        return R.success(result);
    }

    // Endpoint for enterprise differential analysis
    @GetMapping("/enterprise2/{questionId}")
    public R<Map<String, Map<String, List<Double>>>> getEnterpriseDifferenceAnalysis(@PathVariable Integer questionId) {
        Map<String, Map<String, List<Double>>> result = differenceSortQuestionAnalysisService.getEnterpriseDifferenceAnalysis(questionId);
        return R.success(result);
    }

    // Endpoint for role differential analysis
    @GetMapping("/role2/{questionId}")
    public R<Map<String, Map<String, List<Double>>>> getRoleDifferenceAnalysis(@PathVariable Integer questionId) {
        Map<String, Map<String, List<Double>>> result = differenceSortQuestionAnalysisService.getRoleDifferenceAnalysis(questionId);
        return R.success(result);
    }
}